<template>
<div style="width:95%;height: 100%;">
  <div style="width:95%;height: 33%;">
    <!-- <chart-element style="height:95%" :echartsData="params"></chart-element> -->
    <chart-histogram style="height:95%" :echartsData="paramA"></chart-histogram>
  </div>
  <div style="width:95%;height: 33%;">
    <chart-histogram style="height:95%" :echartsData="paramB"></chart-histogram>
    <!-- <chart-element style="height:95%" :echartsData="params1"></chart-element> -->
  </div><div style="width:95%;height: 33%;">
    <chart-histogram style="height:95%" :echartsData="paramC"></chart-histogram>
    <!-- <chart-element style="height:95%" :echartsData="params3"></chart-element> -->
  </div>
  </div>
</template>

<script>
import ChartElement from "@/views/diagnosticview/ChartElement.vue";
import ChartHistogram from "@/views/diagnosticview/ChartHistogram.vue";
import {
  getfaultCount
} from '../../api/diagnosisoverview'
export default {
    components:{
        ChartElement,
        ChartHistogram
    },
    data() {
        return {
          valvehallId:1,
          paramA:{
            title:'按故障级别统计',
            source:{data1:['一般故障','严重故障'],data2:[]}
          },
          paramB:{
            title:'按故障类型统计',
            source:{data1:['晶闸管故障','BOD动作','阀控故障'],data2:[]}
          },
          paramC:{
            title:'按故障部件统计(已处理)',
            source:{data1:['晶闸管故障','TCE','电阻电容','阀控板卡','其他'],data2:[]}
          },
            // params:{ 
            //   title:'按故障级别统计',
            //   dimensions: ['product', '一般故障', '严重故障'],
            //   source: [
            //     {product:'Y1','一般故障': 43.3, '严重故障': 85.8,}
            //           ]
            //   },
            // params1:{ 
            //     title:'按故障类型统计',
            //   dimensions: ['product', '晶闸管故障', 'BOD动作', '单阀冗余数'],
            //   source: [
            //     { product: 'Y1', '晶闸管故障': 46.3, 'BOD动作': 85.8, '单阀冗余数': 93.7 },
            //     { product: 'Y2','晶闸管故障': 83.1, 'BOD动作': 73.4, '单阀冗余数': 55.1 },
            //     { product: 'Y3', '晶闸管故障': 86.4, 'BOD动作': 65.2, '单阀冗余数': 82.5 },
            //           ]
            //   },
            //   params3:{ 
            //     title:'按故障部件统计',
            //   dimensions: ['product', '晶闸管故障', 'BOD动作', '单阀冗余数'],
            //   source: [
            //     { product: 'Y1', '晶闸管故障': 46.3, 'BOD动作': 85.8, '单阀冗余数': 93.7 },
            //     { product: 'Y2','晶闸管故障': 83.1, 'BOD动作': 73.4, '单阀冗余数': 55.1 },
            //     { product: 'Y3', '晶闸管故障': 86.4, 'BOD动作': 65.2, '单阀冗余数': 82.5 },
            //     { product: 'Y4', '晶闸管故障': 72.4, 'BOD动作': 53.9, '单阀冗余数': 39.1 },
            //     { product: 'Y5', '晶闸管故障': 30, 'BOD动作': 50, '单阀冗余数': 60 },
            //     { product: 'Y6', '晶闸管故障': 30, 'BOD动作': 50, '单阀冗余数': 60 },
            //           ]
            //   }
    }
        
    },
    methods: {
      faultCount(){
        getfaultCount(this.valvehallId).then(response => {
          console.log("故障统计",response.data)
          this.paramA={
            title:'按故障级别统计',
            source:{data1:['一般故障','严重故障'],data2:[]}
          }
          this.paramB={
            title:'按故障类型统计',
            source:{data1:['晶闸管故障','BOD动作','阀控故障'],data2:[]}
          }
          this.paramC={
            title:'按故障部件统计(已处理)',
            source:{data1:['晶闸管故障','TCE','电阻电容','阀控板卡','其他'],data2:[]}
          }
          this.paramA.source.data2[0] = response.data.一般故障
          this.paramA.source.data2[1] = response.data.严重故障
          this.paramB.source.data2[0] = response.data.晶闸管故障
          this.paramB.source.data2[1] = response.data.BOD动作
          this.paramB.source.data2[2] = response.data.阀控故障
          this.paramC.source.data2[0] = response.data.晶闸管故障
          this.paramC.source.data2[1] = response.data.TCE
          this.paramC.source.data2[2] = response.data.电阻电容
          this.paramC.source.data2[3] = response.data.阀控板卡
          this.paramC.source.data2[4] = response.data.其他
        })
        console.log("数据", this.paramC.source)
      }
    },
    created() {
      this.faultCount()
    }
    
}
</script>

<style>

</style>